package help_center

import (
	"hft/Http/Services/front/help_center"
	utils "hft/Http/Utils"
	"strconv"

	"github.com/gin-gonic/gin"
)

type HelpCenter struct{}

func (*HelpCenter) List(c *gin.Context) {
	list := help_center.HelpCenterService.List()

	utils.OkWithData(list, c)
}

func (*HelpCenter) Info(c *gin.Context) {
	var id, _ = strconv.Atoi(c.DefaultQuery("id", "0"))
	if data, err := help_center.HelpCenterService.Info(id); err != nil {
		utils.FailWithMessage(err.Error(), c)
	} else {
		utils.OkWithData(data, c)
	}
}

var HelpCenterController = new(HelpCenter)
